Sql parameters

Fixed some bugs that were introduced by the SQL Parameters changes