Cleaned up warnings
Fixed a serious error caught by clang's warning system