fixes for #41, #42, #40, #43

fixes for #41, #42, #40, #43