changed MAX_VAL const