lib/pry/pry_class.rb fix initialize bugs of Pry.config and Pry.history

In rare cases(issue #978) Pry.config is initialized to unintended Object. To fix this problem, check classes of Pry.config and Pry.history before initialize them.