bug and example fixes