Custom field fixes and some optimization