Fixed environment check.
Added calls to callback.