Refactored to have a better stacktrace in case of server error