fixed authorization bugs