patches to corrects bugs