Corrected callback function