avoid memory error