code compiles, but bug exists