fix allocation memory