repaired the code