Fixed indexOf bug, nth instead