It is a good idea to check that the variables your script is receiving are in fact of the correct type in terms of value...