Fixing error in code