added has method and improve exception message