adding protection against null error returned from lua