Fix API usage
Fix build and semantic issues