retab and modify to work with latest r509