fixed some logical errors in previous commit