move prefix process to lua script