Debug a few bugs

Debug version