variable 'sql' is uninitialized when used here