Fixed value casting in case of error and added option for array of values.

Signed-off-by: Johny Jose <johny@playlyfe.com>