R language related fixes - by Philipp Marek