Fix some bugs #4