checking arguments (copied from lab1)