cleanup and tests related to #505