Fixed a compiler error due to function refactor