class handling bug fixed