fixes #533 Fix a comical type-cast bug originally authored by yours truly