better gen-hook
better generate code