replace $exception
fix encode null object