Fixed bug with density reading