fixed java stack bugs