fixes and cleanups per bug #19