Fix some bugs in Linux