revert part of 5fa636 due to performance hit (#830)