fixed bugs 574 and 577