Fixed SQL, bugfix