Fixed allocation bug