cleaner impl of #856