fix small bugs; 100% test coverage