Fixed faulty print statement in density_test
Fixed bug in bounds checking for Grid type.