fixes #234, and probrarly more issues