Check for existence of callback

Added "if (callback) ..." on line 213 to avoid crashes in case it isn't set (db.create() is just one good example for that).

Sorry about all the other changes, my emacs config did a few format changes there (trailing whitespace removal and so on). I didn't change any functional parts there.