some frame code write by myself