Fix for hashing long keys and spaces in key names

I've fixed two issues with the validateArgs function having to do with invalid keys.