Made some fixes based on @nikic's comments