fixes #152

Please see my changes to solve this issue. 

If I need to change any of the code please let me know.