fixing preview bug