Made several changes to allow building on with strict compiler settings