Cleanup to compile on gcc 4.7, remove warnings