fixing a bug to complete #8