Fixed error where old sessionkey would be used in API call