Error fix - thanks to @ujifgc for the code review