Fix memory checks