implemented part of kaleido fix from patrick