fixed some allocation errors and marked unfixed by FIXMEs