Fix some bugs under linux