bugs and indentation fixes