Fix access to dirname