Fixed fatal error on non-object