Fixing incorrect function