Fixed some performance hot-paths