fixed heap allocation now performs second example succesfully