Preview is not properly working