fixing a bug to make it work