Various fixes to get backend working.