fix issue #2 #3 #4 #5 #6
fix the issue #8
fix the issue  #7
remove all the warnings