Don't try to call callback when not defined

Fix for "Uncaught TypeError: undefined is not a function"