trap formula, bugfixing