fix some stuff suggested by scrutinizer