fix type initialization and leaks; fix prepend