fixed some stupid bugs. shame on me