Fixed issues #39 #43 #47