Bugfixes & tests

subj