Proper interpretation of ENDNUM and IMBNUM fields.

Made consistent with grid discretization.