fixed bug with rearranging after sql, finished sql for tasks