Better error handling

console