Runtime fixes and cleanup