fix bugs from changing schema