inserted a warning and fixed a leak