replaced undefined with 0 to fix onHide bug