fix a couple bug in sql server storage