Added check for safe loading