Fix the code to work with recent changes