fixed detection of schema -- it was reversed