Fixed bug with large chemical formula generation