Fixing a shit bug with untested code

Enjoy. Patch at your own risk.