fixing a bug with non matching brackets crashing the server