added code to update sz, still has a lock problem