fixing login required and TypeError with string