switching output in right place