fixed some problems and fixed a testing issure