fixing a bug - thanks @killmous