Fixed bugs fix #2 #3