fixed some bugs thx to jesse from mediamonks.