Only set the session if it's not null
Fixed a typo
Merge pull request #6351 from GrahamCampbell/5.0-form

[5.0] Only Set The Session If It's Not Null