Fixes multiple issue with recent change.

Signed-off-by: crynobone <crynobone@gmail.com>