Removed bug in code