overwriting core Session library to avoid race conditions.