Fix bug in mag type to numeric func.