before setting me = shape, make sure to do me = NULL.
otherwise the pointer to me will be overwritten to be shape (from the function this calls).
same goes for before me = old_me.
hope that was clear, otherwise i'll have to make a drawing that explains what goes wrong... but i somehow feel you dont really need that.
regards,