Fix template crash on invalid signature