added stability check to analyze.cpp