Fix CrossOS issues, and minor java warnings