sql dump and some fixes