Fixed a bug where a wrong function was applied...