added some checks/stuff