fix glitches found by scrutinizer