Fix compilation warnings.

The string.h include was necessary for compilation (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)).

The other changes just tidy up compilation warnings.