added checks and additional tests