Fixed matching brackets validation