Add failsafe to prevent writing illegal values to file
Merge branch 'dev' into multifile