Fixes #2 bug where script would break if null class attribute was present