how about checking instead something like 
if (pageMap[k] is Map) instead of using the printed toString value.