GPII-569: Added check if the preferences object is undefined

See detailed description of bug and fix here: http://issues.gpii.net/browse/GPII-569