Fix bug: function not called