compiles but incorrect output