added error msgs for invalid data