Implemented fix for issue #175

The suggested fix in issue #175 seems to work for me too, here are the actual changes.