Fixed SQL references