updated old code accidentally reintroduced by 83c4e04b89f639375600c6e7d5dcdeb63fa044b9