Bug fix and dir cleanup