fixed code that produces an error