Added empty check and default value for data array. Fixes #9