patch for bugs, indentation also cleaned up from jafl