Correct fix for #282

Thanks @pmario and @andrey013