fixed casting problem. MaxNumberOfPoints was treaded as a string.
fixed check on maxNumberOfPoints