Fixed a potential issue when using bad input parameters.