Added some extra error clauses