added error check for command line arguments