Actually set dirname before use