Error-proofed code slightly

To help indicate what went wrong and why.