fix two bugs