add guard and mysql connect