fix optimization errors

Signed-off-by: Zhao Wei Liew <zhaoweiliew@gmail.com>