s4-auth: Fix some debugging and crash in error cases