Fixes #705

Fixes #705 

This is my contribution. I did some testing, and it seems to be working fine, but of course is your project so you should know better.