Resolved critical bugs from scrutinizer