Made sure it works for virtual directories

Made sure it works for virtual directories.