Fixed further issue with #66, added proper testing