made small changes

added if to exit for invalid number of arguments