fixed printing and small bugs