Fix cookie parsing and get() on NoneType object