added position checks