added function checkRight