fixed bugs introducted in the last commit