Fixed the dirname() bug correctly.