Added sanity checking to task routine.

This stops you making fatal mistakes when configuring your routines.