Fix a build problem with the -lm flag for Linux, clean up some compiler warnings.