add loader, error message, clean up resources