Prevent race condition on return