*fixed out of range check not being correct