changes from monday
added test and fix critical bugs