fixes for sql

stupid mistakes :(
didn't test it before I upload it