added sanity checks for arguments