Fix paths by using the dirname function