Fixing tutorial code snippet