Fix a few issues noted by scrutinizer