use xpcall to protect imx call
imx frame count is more precise