Fixing a few bugs. Still need to check for the backtrack analysis.