Attempted sql fixes