fix bugs from xinjie