fix references
javascript assertion executing before callback returns