fixed bugs introduced in 54a98a9713eb1ace3b7c1d649746470449e307cb