debug and minor changes