Fixed issues #1 #3 #5