small bugfix, still not entirely correct