fix critical bug for production, including testing