bug fixing and adding tests for analyze commands