SAM API integration code fixes