fixed static bug causing seg fault