Few small improvements for previewbuildscript

Not sure about last commit, maybe we should improve it first.