Fix issue that session stores functios to database