fixed functools bug
(#325)