applying function but not working