added error passing to load function