Fix preview functionality