fix rect bugs