Improve error handling

m8