Fixed some really stupid programming errors