add exitCode parameter for callback
fix a bug which broke tests
update docs