- fixed some code bugs