Fix bugs with heap insert and market monitor