Improved url security check