fix stack and interrupt bugs