Fixed bug in callback and seperated global errors.