Added error handling for all WriteElement calls
Merge pull request #16 from dotdoom/error-handling

Added error handling for all WriteElement calls