fix a bug with session creation