change handling of emit once, fix whitespaces