Added check to make sure motor pointers are not null