I know it's rather fugly, but I couldn't think of a better way to do it:

* if there is no such parameter, default to 3
* if the parameter exists, ensure it's a number
* complain (below) if it's not a number