fixed a bug with the printf routine