Fix for #240 - thanks to ufischer