handle both cases of -1