added some tests, fixed some issues