Dynamic Memory fixes