fix #1 #3 #4 #5