Replace misplaced echo commands with printf