Fixed bugs #42 #41 #35