traps and other bugfixes