Removing a console log that throws undefined exception