Fixed. Added format checks for write functions.