solving habitat merge problem more.