Bug and indentation fixes