2nd attempt to fix code bug