Fix old bugs

Fix for #8 #53 and #72