Tests and bugfixes hm

Fixed #38, #49