more improvements to impl of #406