handling keyerror