Fixed SQL calls