Balance bugfix and some date functions