Fixes proposed by scrutinizer