fixed missing code that was removed when testing