Debugging

fixed some bugs