Fixing some bugs with references not being set
fixing some event and chunk issues