fix problem with previous fix
Reduce repetitive printout & fix compiler warnings