add tests - fixes minor bugs