add class message and fixed more bugs