Fixed bug with adding a new pattern