Fixed some serious logic error -- still not working