Program that compiles, end position bug