fixes for Sql Server