improve error handling for arguments