re-impliment authentication, fix some resurrection logic