Added try blocks and conditional for attributes which may not exist. Fixes #1