fixing bugs in WWDC 2012's 219 session sample code