abspath for dirname is important