fixed/tweaked to make work on release server