Fixed SQL bug (boolean does not convert from mysql to sql well)