fix bound check.