Fixed a bug with invalid function call