Fixed some shared logic