replace IllegalStateException with IllegalArgumentException