I actually haven't seen self.nclasses defined anywhere, did you forget to commit something?
Also, would you mind making it num_classes? I know the library isn't very consistent but we're trying to move toward always using that form.