Added safe_mode for catch users exceptions and for prevent core-dumps