fixed erroneous code snippet