bug with variable $class fixed