better setSchema logic