fix an overflow and add some debug to identify problems with theta filters