getting output correctly