fix type; add tests for -1