F: fix performance problems