added missing blocks in if clauses