Merging Canvox's patch 

Seems like a good fix, thanks canvox.