Fix pre and post condition handling in functions

This was already merged in by frank, but I managed to make a release without pulling the merge. Gah!