add credential recovery template & fix bugs