Ensure the session key is a string before using it.