fixing minor bugs to make functional tests pass, closing #50