fixed bug on function controller