Changed error message and reordered null referer conditional