added some fixes, removed debug