fix bug in sql metadata