add ready event, better debugging