fix null check in replaceSquareBrackets