Fixed bug

Because of the isPlain function had been removed from lib.js, so changed
the code.