fixes/changes suggested by Marcin Kosedowski