exceptions added + bug fix