Cleaup -1 and NULL callback handling for custom extensions, add tests.