fix bugs and add new analysis