more proper way to check for class attribute existence