protect againt bad attribute types
add newline at end of generated file

this is the unix way, afterall