Fix some bugsg