fixed with Chyld's code