get density method to work properly