Fixed error caused by moving the function.