Backend fixes for sql changes