spell error fixed, changed to global function