Various fixes and localstorage now works