added new tests and fixed some issues