Make main callback accessible to compiler chain

to fix error handling

Resolves #709