Remove the "pseudosig" hack.
The variable 'idx' is used as an array index before it is checked that is within limits. This can mean that the array might be accessed out of bounds.
Fix debug() logging to work with previous changes.