check_arguments function

Check if arguments are valid (internal)