fix stack() bug