fix crash when open fails