Fixed bugs in analysis