fixed some errors with logic to actually work