Fix linux build and some warnings