Closes #111 (and an entire class of bugs)

Tough one... but it's fixed now