handling issues #3,4,7,15.

Fixed issues #3,4,7,15.