Checking index to be greater than -1