change few issues and add tests