fixing wrong upper bound in error reporting