minor code cleanup and dirty fix for recent api changes