fixed out of bound bug