Move the ref increment right after alloc
Bad code fixes