Fixes for [FLINK-1181] and [FLINK-1182]