fixed an out of range error