fixed endVal issue