added custom ready event
added fix for ready event