fixed negativearrayindex issue