fixed dirname stuff