Improve error handling on unsafe mode