Fixed a bug in the logic of checking for correct number of arguments