fix bug in apex lo<=val<=hi