fixed incorrect function