Remove trailing coma as it makes a tuple instead of a simple value
Add common checks and fix printing format