Fix bugs in SQL Storage system.