fixing code snippet