Check that ep_session_id is valid before adding to object

This avoids confusing debug errors related to WP_Error objects