added optional tests and fixes