Fixes #57
Possibly fix #59 - Haven't been able to reproduce the bug.