merge changed from JR Fork