add alert when add class and fix bug in it