Fixes to rebase and to previous commit.

Turns out module.program only works sometimes and we should have used
module.get_program().