fix some BUGs