removed bug in code