several fixes and adding __dir__