Cleanup and bug fix for PUB-1069.