fixed null pointer error and added error message