Fix revision calculation