added few checks