fixed bugs (hopefully)