Apply patch from @rosorio, fixes #1