fixing check_memory