Added an isset check to avoid PHP notices.