heap detection problem