use filepath.Dir instead of something weird