Bugfixes
Closes #37 and #38