Analysis fixes
Fix analysis bugs