Bug fixes with unset variables

Added isset to if statements asserting whether or not a variable is set.