fixed bugs with preview