Fixes #1008
rebased onto b0e222d3c0d4aee45d2165159f736279c0e5ce77
Thanks!
Pull-Request has been merged by pbokoc
Fixes #1008