catch some errors and add support for specifying vendor or app
add optimist dependency