Fixing code snippet