test trivial allocate and fix bugs found