Should fix issues #442 and #431

My first pull request after my first fork on git, I hope I did things well