Added various fixes for analysis problems