fix SQL error caused by code cleanup

#3083