Fixed some bugs on linux