Fixed multiple PHP notices: Undefined variable/index