Some improvements for creating dirs in media db.