fixed bugs and indentation