Fixed: instance where $dirname was not set correctly