fix allocation of wrong type