Many fixes for Linux