properly evaluate function