added more informative error messages when invalid parameter count