minor cleanup and fixes for upstream changes