Attempted fix for the “nan” bug