Fixed a few bugs based on erroneous reading from database when unneeded