Fix isPublic and optimizations.