fixed that function