Fix various bugs in working example