Fix certain bugs