fixing some sql stuff again