added error and metrics, also fixed login bug