debugging this bunch of mistakes?