Fix bug with extra brackets at the end of the line