removed cli check in error(), minor refactoring