fix(hooks): return values defaults to null in javascript

Fixes #6499
fix(hooks): handlers returning null/undefined don't change returnvalue in javascript

Fixes #6531