Added alg back to the header and added support for loads_unsafe
Sanity check in case the header payload is not a dictionary