iImprove login/out for functional tests