debug some bugs