More fixes for dynamic allocation