Fix bug and correct indentation