add check for nil of title and classes