add a small condition check to hugly improve the efficiency