Added error message for invalid data