Addresses iandanforth/nupic-js#13.

Added some checks and default values to prevent errors.