Indentation not working as expected

Hi,
When pressing enter to create a new line, the indentation is perfect, but when pressing enter again and then pressing the up arror (to go to the previous line) the indentation on that line is removed.
When pressing Enter on an empty line (with no indentation), it indents too far to the right. My tab length is set to 3.