Added some event handlers to buy dialog