small fix in light algorithm