Fix: Bugs reported by scrutinizer