API logout fix