Fixed problem with JS for purchasing shares