Possible fix for #412
Small optimization for #412 fix
Style change as requested by @raggi
Merge pull request #593 from urielka/master

Possible fix for #412