Fixing a little bug in my implementation