Fix import issue.
Fix exceptions handling.
Fix PEP8 issues.