fix all test bugs + prepare for master merge