Fix two bugs