fixed bug with r flag