Erase whole memory when no range is specified
Fix range issues