changed $user to $userid