fixed the case of ] and ) and newline