fix TMP_DIR
refactor Excption inheritance
update docblocks