fix a bug in frame.c