fix bug in frame capture function