Fix potential issues to make klocwork happy