fix a bug when using ::-1