Added message and corrected a bug