Fix some bugs. #2